<!--个人主页-->
<ion-view ng-controller="ion_person_sendMsgToUser" view-title="与 {{receiver.attributes.nickName}} 对话">
    <ion-nav-buttons side="right">
        <button class="button button-clear button-balanced" ui-sref="person.my">我</button>
    </ion-nav-buttons>
    <ion-content>
        <!-- 对方用户信息-->
        <ion-user-info ng-if="receiver" user="receiver"></ion-user-info>
        <!-- 二手书信息-->
        <ion-one-used-book used-book="usedBook"></ion-one-used-book>
        <ion-item ng-if="receiver && usedBook.attributes.alive && usedBook.attributes.owner.id===User$.me().id">
            <button class="button button-block button-small button-balanced"
                    ng-if="usedBook.attributes.role==='sell'"
                    ng-click="sellUsedBookToUser()">
                已决定卖给Ta
            </button>
            <button class="button button-block button-small button-balanced"
                    ng-if="usedBook.attributes.role==='need'"
                    ng-click="gainUsedBookFromUser()">
                已成功从Ta获得
            </button>
            <button class="button button-block button-small button-balanced"
                    ng-if="usedBook.attributes.role==='circle'"
                    ng-click="deliverUsedBookToUser()">
                已决定传递给Ta
            </button>
        </ion-item>
        <!-- 聊天记录-->
        <ion-item style="margin: 0;padding: 0;border-right: none;border-left: none">
            <ol ng-if="statusList.length>0" style="margin: 5px;padding: 0;list-style-type:none;">
                <li ng-repeat="status in statusList"
                    style="display: block;clear: both;border-radius: 10px;padding: 5px;margin: 5px;max-width: 80%;white-space: normal;"
                    ng-style="{'float':status.attributes.source.id==receiver.id ? 'left':'right','background-color':status.attributes.source.id==receiver.id ? '#30bf4c':'#e6e5eb'}"
                    ng-bind="status.attributes.message">
                </li>
            </ol>
        </ion-item>
        <!-- 当前聊天模式-->
        <ion-item class="item-divider" style="text-align: center;white-space: pre-wrap" ng-if="msg.title"
                  ng-bind="msg.title"></ion-item>
        <!-- 我的输入框-->
        <label class="item item-input">
            <textarea rows="5" ng-model="msg.sendMsg" placeholder="输入回复内容"></textarea>
        </label>
        <!-- 发送-->
        <button class="button button-block button-outline button-balanced"
                ng-disabled="!msg.sendMsg || isLoading"
                ng-click="sendOnClick()">发送
        </button>
        <!-- 正在加载-->
        <div style="text-align: center;padding-top: 10px" ng-if="isLoading">
            <ion-spinner icon="ripple" class="spinner-balanced"></ion-spinner>
        </div>
        <!-- 常用回复语-->
        <ion-list ng-if="commonReplayWords.length>0">
            <ion-item class="item-divider item-button-right">快速回复内容</ion-item>
            <ion-item style="white-space:normal;padding: 5px;text-align: center">
                <button class="button button-small button-outline button-balanced" style="margin: 5px"
                        ng-disabled="isLoading"
                        ng-repeat="word in commonReplayWords"
                        ng-click="msg.sendMsg=word"
                        ng-bind="word">
                </button>
            </ion-item>
        </ion-list>
    </ion-content>
</ion-view>